<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>个人页面</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
		<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
		<script src="/js/jquery/jquery.min.js"></script>
		<script src="/js/bootstrap/js/bootstrap.min.js"></script>
		<script src="/js/plugins/jrender/jrender.min.js"></script>
		<link rel="stylesheet" href="/css/font/css/font-awesome.min.css">
		<link rel="stylesheet" href="/css/reset.css">
		<link rel="stylesheet" href="/css/userProfiles.css">
		<link rel="stylesheet" href="/js/plugins/jquery-confirm/css/jquery-confirm.css">
		<script src="/js/plugins/jquery-confirm/js/jquery-confirm.js"></script>
		<script src="/js/common.js"></script>
	</head>
	<script>
		$(function () {
            var users = sessionStorage.getItem("user");
            var user = JSON.parse(users);
			$("#followBtn").click(function () {
                $.confirm({
                    animation: 'right',
                    closeAnimation: 'right',
                    animationSpeed: 1000
                });

            });
			$("#letterBtn").click(function () {
                $.confirm({
                    title: '私信内容',
                    content: '' +
                    '<form action="" class="formName">' +
                    '<div class="form-group">' +
                    '<label>请在这里输入您的私信内容(不得大于15字符)</label>' +
                    '<input type="text" placeholder="请输入私信内容" class="name form-control" required maxlength="15"/>' +
                    '</div>' +
                    '</form>',
                    buttons: {
                        formSubmit: {
                            text: '确认',
                            btnClass: 'btn-blue',
                            action: function () {
                                var name = this.$content.find('.name').val();
                                if(!name){
                                    $.alert('至少输入一个字段');
                                    return false;
                                }
                                $.get("/users/"+user.id+"/"+params.id+"/"+name+"/letters",function (data) {
                                    if (data.success){
                                        window.location.reload();
									}else {
                                        $.alert(data.msg);
									}
                                })

                            }
                        },
                        关闭: function () {
                            //close
                        },
                    },
                    onContentReady: function () {
                        // bind to events
                        var jc = this;
                        this.$content.find('form').on('submit', function (e) {
                            // if the user submits the form by pressing enter in the field.
                            e.preventDefault();
                            jc.$$formSubmit.trigger('click'); // reference the button and click it
                        });
                    }
                });
            });

			//获取用户数据
			var params=getParams();
            $.get("/users/"+params.id,function (data) {
                $(".user").renderValues(data)
            });
            $.get("/users/"+params.id+"/travels",function (data) {
                console.log(data);
                $("#travels").renderValues(data,{
                    setHref:function (item,value) {
                        $(item).attr("href",$(item).attr("href")+value)
                    }
                })
            })
        })
	</script>
	<body>
		<div class="container bg" style="background-image: url(&quot;/img/user/bg.jpeg&quot;);">
			<a href="javascript:window.history.go(-1)" class="my-arrow">
				<span><i class="fa fa-chevron-left fa-2x"></i></span>
			</a>
			<div class="container">
				<div class="info user">
					<img class="rounded-circle" width="17%" render-src="headImgUrl">
					<p class="name" render-html="nickName"></p>
					<p render-html="sign"></p>

					<div class="row num">
						<div class="col-2 border border-left-0 border-top-0 border-bottom-0">
							<div>
								<span >1</span>
							</div>
							<div>
								<span>关注</span>
							</div>
						</div>
						<div class="col-2">
							<div>
								<span>0</span>
									</div>
							<div>
								<span>粉丝</span>
							</div>
						</div>
						<div class="col">
							<button class="btn btn-outline-light ibtn" id="letterBtn">私信</button>
							<button class="btn btn-success ibtn" id="followBtn">关注</button>
						</div>
					</div>
				</div>
			</div>
		</div>

		<div class="tabs">
			<ul class="nav nav-pills nav-justified  border border-left-0 border-top-0 border-right-0" id="pills-tab" role="tablist">
				<li class="nav-item">
					<a class="nav-link active" id="travels-tab" data-toggle="pill" href="#travels">
						TA的游记[<span>1</span>]
					</a>
				</li>
				<li class="nav-item">
					<a class="nav-link " id="comments-tab" data-toggle="pill" href="#comments">
						TA的点评[<span>1</span>]
					</a>
				</li>
				<li class="nav-item">
					<a class="nav-link" id="pills-contact-tab" data-toggle="pill" href="#pills-contact">
						TA的旅行单[<span>0</span>]
					</a>
				</li>
			</ul>
			<div class="container tab-content" id="pills-tabContent">
				<div class="tab-pane fade show active" id="travels">

						<dl class="list" render-loop="list"><dd>
								<a href="travelContent.html?id=" render-fun="setHref" render-key="list.id">
									<img  render-src="list.coverUrl">
									<p><span class="title" render-html="list.title"></span>
										<span class="span-right">
						 				<span >0</span> <i class="fa fa-thumbs-o-up"></i></span>
									</p>
								</a>
								<hr>
							</dd></dl>
				</div>

				<div class="comment tab-pane fade " id="comments">
					<input type="hidden" name="currentPage" value="1">
					<input type="hidden" name="pageSize" value="5">
					<input type="hidden" name="rows" value="1">
					<div><div class="row">
							<div class="col-2 comment-head">
								<img  class="rounded-circle" src="/upload/7e854d1d-a7be-4360-8943-8771d18ee0e3.jpg">
							</div>
							<div class="col">
								<span class="comment-star" ><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star"></i><i class="fa fa-star-o"></i><i class="fa fa-star-o"></i></span>

								<span class="comment-date" >2018-07-11</span>
								<div class="comment-content">
									<a href="strategyComment.html"  data-id="4">
										<p >骑了个单车到沙面，春风把从上下九和宝华路带来的燥热吹散。沙面临江，下午的时光让这富有异国风情的公园显得更加宁静惬意，哪怕...</p>
									</a>
								</div>
								<ul class="comment-img"><li>
										<img  src="/upload/63bb765d-5dff-44f8-b7f1-cb338b9b9f95.jpeg">
									</li><li>
										<img  src="/upload/7d437f8d-a476-465c-bd84-e93a03d8efd5.jpeg">
									</li></ul>

								<div class="comment-link">
									<a href="strategyCatalogs.html" data-id="2">
										<img  src="/upload/e5e8a1a7-b127-4145-9fd0-a94e29f752ba.jpeg"> <span >广州攻略</span>
										<i class="fa fa-angle-right fa-2x"></i>
									</a>
								</div>

							</div>
						</div></div>

				</div>
				<div class="tab-pane fade" id="pills-contact">.3333..</div>
			</div>
		</div>



</body>
</html>